<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html >
<head>
	<meta name="decorator" content="sysDefault" content="text/html; charset=utf-8"/>
	<script src="${staticPath}/js/pospay/opendialog.js" type="text/javascript"></script>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#key").focus();
			$("#dataForm").validate({
				submitHandler: function(form){
					Oosp_Loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
			var isDropdown = "<c:out value="${siteNav.isDropdown}"/>";
			var target = "<c:out value="${siteNav.target}"/>";
			var href = "<c:out value="${siteNav.href}"/>";
			if(isDropdown != null && isDropdown != "" && isDropdown == 0){
				//编辑初始化选中是
				changeIsDropdown(isDropdown);
				$("#target").val(target);
				$("#href").val(href);
			}else{
				//新增初始化选中是
				changeIsDropdown(1);
			}
			
		});
		
		//选择是否的改变事件
		function changeIsDropdown(value){
			if(value == 1){
				$("#target").attr("disabled",true);
				$("#href").attr("disabled",true);
			}else{
				$("#target").attr("disabled",false);
				$("#href").attr("disabled",false);
			}
		}
	</script>
</head>
<body>
	<div class="container-fluid">
		<div class="row">
			<div class="col-xs-12">
				<div class="panel panel-default">
				  <div class="panel-heading">
				    <h3 class="panel-title">编辑数据
						<a class="btn btn-default btn-sm pull-right" role="button" href="${contextPath}/sys/site/${siteNav.siteId}/view" >返回</a>
				    </h3>
				  </div>
				  <div class="panel-body">
					<form:form id="dataForm" modelAttribute="siteNav" action="${contextPath}/sys/sitenav/save" method="post" class="form-horizontal" role="form">
						<form:hidden path="id"/>
						<tags:message content="${message}"/>
								<div class="form-group">
									<label for="rowNo" class="col-sm-2 control-label">名称:</label>
									<div class="col-sm-2">
										<form:input id="name" path="name" maxlength="80" class="form-control"/>
									</div>
								</div>
								<div class="form-group">
									<label for="bankArg" class="col-sm-2 control-label">是否是下拉导航:</label>
									<div class="col-sm-2">
										　
										<form:radiobutton id="isDropdown" path="isDropdown" value="1" onchange="changeIsDropdown(this.value)" checked="checked"/> 是　　　
										<form:radiobutton id="isDropdown" path="isDropdown" value="0" onchange="changeIsDropdown(this.value)"/> 否
									</div>
								</div>
								<div class="form-group">
									<label for="bankNo" class="col-sm-2 control-label">排序号:</label>
									<div class="col-sm-2">
										<form:input id="orderNo" path="orderNo" maxlength="4" class="form-control" onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" />
									</div>
								</div>
								<div class="form-group">
									<label for="bankName" class="col-sm-2 control-label">目标:</label>
									<div class="col-sm-2">
										<form:input id="target" path="target" maxlength="20" class="form-control" value="_self"/>
									</div>
								</div>
								<div class="form-group">
									<label for="bankArg" class="col-sm-2 control-label">链接地址:</label>
									<div class="col-sm-2">
										<form:input id="href" path="href" maxlength="1000" class="form-control" value="/index"/>
									</div>
								</div>
								
								<div class="form-group">
									<label for="bankArg" class="col-sm-2 control-label">上级导航:</label>
									<div class="col-sm-2">
										<form:input id="parentName" path="parentName" maxlength="20" class="form-control" disabled="true"/>
										<form:hidden id="parentId" path="parentId" />
									</div>
								</div>
								<div class="form-group">
									<label for="bankArg" class="col-sm-2 control-label">权限标示:</label>
									<div class="col-sm-3">
										<form:input id="permission" path="permission" maxlength="40" class="form-control" />
									</div>
								</div>
								
								<div class="form-group">
									<label for="bankArg" class="col-sm-2 control-label">备注:</label>
									<div class="col-sm-2">
										<form:textarea id="remarks" path="remarks" maxlength="500" class="form-control" />
									</div>
								</div>
								<div class="form-group">
									<label for="bankArg" class="col-sm-2 control-label">是否显示:</label>
									<div class="col-sm-2">
										　
										<form:radiobutton id="isShow" path="isShow" value="1" checked="checked" /> 是　　　
										<form:radiobutton id="isShow" path="isShow" value="0" /> 否
									</div>
								</div>
								<form:hidden id="siteId" path="siteId" />
									
						<div class="form-group">
						  <div class="col-sm-offset-2 col-sm-10">
						    <input class="btn btn-primary" type="submit" value="保 存"/>
							<a class="btn btn-default" role="button" href="${contextPath}/sys/site/${siteNav.siteId}/view" >返回</a>
						  </div>
						</div>
					</form:form>
				  </div>
				</div>			
			</div>
		</div>
	</div>
</body>
</html>